﻿
using Lrd.Permissions.Core.Entity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage;
using System;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Lrd.Permissions.Repository
{
    public interface IUnitOfWork
    {
        DbContext GetDbContext<TEntity, TKey>() where TEntity : IEntity<TKey>;


        void BeginOrUseTransaction();

        void Commit();


        IEnumerable<TResult> FromSql<TResult>(string sql, object param = null);

        Task<IEnumerable<TResult>> FromSqlAsyc<TResult>(string sql, Dictionary<string, object> param = null);
    }
}
